package com.ldatum.crm.serviceImpl;

import java.sql.SQLException;
import java.util.List;

import com.ldatum.crm.dao.MemberDao;
import com.ldatum.crm.daoImpl.MemberDaoImpl;
import com.ldatum.crm.domain.Member;
import com.ldatum.crm.service.MemberService;

public class MemberServiceImpl implements MemberService {
	
	private MemberDao memberDao = new MemberDaoImpl();

	public int findTodayMembers() throws SQLException {
		return memberDao.findTodayMembers(); 
	}

	public int findBirthdayMembers() throws SQLException {
		return memberDao.findBirthdayMembers();
	}
	
	public int save(Member member) throws SQLException {
		return memberDao.save(member);
	}

	public int update(Member member) throws SQLException {
		return memberDao.update(member);
		
	}
	@Override
	public int deletes(String ids) throws SQLException {
		ids = ids.substring(0, ids.length()-1); 
		return memberDao.deletes(ids);
		
		
	}
	@Override
	public List<Member> query(String cardno, String level, String name,
			String telephone) throws SQLException {
		return memberDao.query(cardno, level, name, telephone);
	}
	@Override
	public Member queryById(int id) throws SQLException {
		return memberDao.queryById(id);
	}

	@Override
	public List<Member> list() throws SQLException {
		return memberDao.list();
	}

	@Override
	public Member findByCardno(String cardno) throws SQLException {
		return memberDao.findByCardno(cardno);
	}

	@Override
	public boolean validationCardno(String cardno) throws SQLException {
		return memberDao.validationCardno(cardno);
	}

	@Override
	public Member findById(int id) throws SQLException {
		return memberDao.findById(id);
	}

	@Override
	public int updateStatusToStoping(String ids) throws SQLException {
		ids = ids.substring(0, ids.length()-1);
		return memberDao.updateStatusToStoping(ids);
	}

	@Override
	public int updateStatusToStart(String ids) throws SQLException {
		ids = ids.substring(0, ids.length()-1);
		return memberDao.updateStatusToStart(ids);
	}

	@Override
	public boolean validationCardnoOrTel(String cardnoOrTel) throws SQLException {
		return memberDao.validationCardnoOrTel(cardnoOrTel);
	}

	@Override
	public boolean validationTel(String telephone) throws SQLException {
		return memberDao.validationTel(telephone);
	}
	
}
